


//删除订单
function deldd(obj){
    var thisObj = $(obj);
    var thisdingdans = thisObj.parent().parent();
    var ddcode = $.trim(thisdingdans.find('span[name=ddcode]').html());   //该客人的订单号
    var uid = $.trim($('span[name=uid]').html());                         //该客人的id

    if(window.confirm('您确定删除吗?')){
       $.get('deldd.php','uid='+uid+'&ddcode='+ddcode);
       thisdingdans.remove();
    }

}

//更新订单
function updd(obj){
    var thisObj = $(obj);
    var thisdingdans = thisObj.parent().parent();
    thisdingdans.find('input').removeAttr('disabled');
    thisdingdans.find('select').removeAttr('disabled');
    thisdingdans.find('input[name=yddate]').attr('disabled',true);
    thisdingdans.find('input[name=chulimeb]').attr('disabled',true);
    thisdingdans.find('input[name=bcdd]').show();
    insertORupdate = 'update';

}

//查看订单
function ckdd(obj){
   var thisObj = $(obj);
   var thisdingdans = thisObj.parent().parent();
   thisdingdans.find('input').attr('disabled',true);
   thisdingdans.find('input[name=ckdd]').removeAttr('disabled');
   thisdingdans.find('input[name=updd]').removeAttr('disabled');
   thisdingdans.find('input[name=deldd]').removeAttr('disabled');
   thisdingdans.find('input[name=selectlishi]').removeAttr('disabled');

   thisdingdans.find('select').attr('disabled',true);

}


//已清算/结单
function yqjd(obj){
   var thisObj = $(obj);
   var thisdingdans = thisObj.parent().parent();
   var ddcode = $.trim(thisdingdans.find('span[name=ddcode]').html());
   location.href = 'iframe.php?del=yq&ddcode='+ddcode;
}

//未清算/结单
function wqjd(obj){
   var thisObj = $(obj);
   var thisdingdans = thisObj.parent().parent();
   var ddcode = $.trim(thisdingdans.find('span[name=ddcode]').html());
   location.href = 'iframe.php?del=wq&ddcode='+ddcode;
}





//查看历史
function selectlishi(obj){

   $('#iframediv').fadeIn("normal");

   var thisObj = $(obj);
   var thisdingdans = thisObj.parent().parent();

   var ddcode = $.trim(thisdingdans.find('span[name=ddcode]').html());

    var a_href = thisObj.attr('href');
    var a_href = a_href.replace(/\?.*/i,'');

        thisObj.attr('href',a_href+'?ddcode='+ddcode);


        /*var thistxt = thisdingdans.children('ul').find('input[type=text],select');

          var lishidiv = thisObj.next();
          var lishitxt = lishidiv.find('input[type=text],select');

          lishitxt.each(function(i){
           var lishiObj = $(this);
           var lishiObjname = lishiObj.attr('name');
           var lishiObjval = lishiObj.val();

           thistxt.each(function(i){
                 var thisObj = $(this);
                 var thisObjname = thisObj.attr('name');
                 var thisObjval = thisObj.val();
                 if(thisObjname == lishiObjname && lishiObjval != thisObjval){

                         thisObj.mouseover(function(){
                                 var thisObj = $(this);
                                 var lishiceng = $('<div id="lishiceng">').html(lishiObjval).css({'position':'absolute','top':'20px','left':'30px'});
                                 $('body').append(lishiceng);
                         }).mouseout(function(){
                                 $('#lishiceng').remove();
                         });
                         return true;
                 }
           });
       });*/
}
